# coding: utf-8
from marshmallow import Schema, fields
from model.model_base import Base
from sqlalchemy import Column, String, DateTime, TIMESTAMP


class PowerSupplyBureauOperator(Base):
    # 局方操作员表
    __tablename__ = 'PowerSupplyBureauOperator'
    openid = Column(String(128), primary_key=True, comment='微信提供openid')
    name = Column(String(50), nullable=False, comment='县局登陆人员姓名')
    power_supply_bureau = Column(String(2), nullable=False, comment='所属县局')
    supervision_department = Column(String(1), nullable=True, comment='督办部门（1计量班长2营销主任3营销局长9供电所人员）')
    remark = Column(String(50), nullable=False, comment='备注')
    jointime = Column(TIMESTAMP(timezone=True), nullable=True,  comment='加入时间')
    stationid = Column(String(2), nullable=True, comment='所属供电所')



class BureauOperatorSchema(Schema):
    openid = fields.String()
    name = fields.String()
    power_supply_bureau = fields.String()
    supervision_department = fields.String()
    remark = fields.String()
    jointime = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    stationid = fields.String()

bureauOperatorSchema = BureauOperatorSchema()
